Skip to content

fix(policies): restrict http.send to remote endpoints in restrictive mode - #3586

Merged
migmartri merged 1 commit into
mainfrom
pfm-7686-reject-tls-options
Oct 9, 2026
Merged

migmartri merged 1 commit into
mainfrom
pfm-7686-reject-tls-options

Conversation

@migmartri

@migmartri migmartri commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

In restrictive mode, the Rego policy engine now limits http.send to plain remote HTTP(S) requests:

  • Requests that use TLS options that load certificates or keys from local files or environment variables (tls_ca_cert_file, tls_ca_cert_env_variable, tls_client_cert_file, tls_client_cert_env_variable, tls_client_key_file, tls_client_key_env_variable) are rejected. Inline TLS material (tls_ca_cert, tls_client_cert, tls_client_key) is still accepted.
  • Requests whose URL scheme is not http or https are rejected.

The check runs on the request object at evaluation time, so it also covers requests built dynamically. It applies to both the CLI and the control plane.

OPA resolves built-ins from a process-wide registry, so http.send is wrapped there. The wrapper fails closed: any OPA evaluation in a binary that imports this package gets the restriction, unless it runs through an Engine in permissive mode, which is unchanged.

Tested with table-driven tests that cover each option, keys built at runtime, the URL scheme, the matches_parameters path, and permissive mode.

This change was produced with AI assistance (Claude Code).

🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri using the eng-autopilot skill

View guided diff

…mode

In restrictive mode, the Rego engine now rejects http.send requests that
use TLS options that load certificates or keys from local files or
environment variables, and requests whose URL scheme is not http or https.
Inline TLS material is still accepted. Permissive mode is unchanged.

Assisted-by: Claude Code
Signed-off-by: Miguel Martinez Trivino <miguel@chainloop.dev>

Chainloop-Trace-Sessions: 7f271228-5972-4af9-a75f-a912318a4bf5
@migmartri
migmartri requested a review from a team October 9, 2026 11:00
@chainloop-platform

chainloop-platform Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

PR validation — ✅ 3 passing

Status Policy Material Messages
✅ Passed pr-min-approvals pr-info -
✅ Passed pr-description-required pr-info -
✅ Passed pr-user-story-linked pr-info -

View attestation ↗

AI Session Checks — 🟢 90% · ✅ 0 failing

Avg score Sessions Failing policies Attribution Files Lines Total Duration
🟢 90% 1 ✅ 0 100% AI / 0% Human 3 +257 / -0 7m48s

🟢 90% — 100% AI — ✅ All policies passing

Oct 9, 2026 10:51 UTC · 7m48s · $5.94 · 308 in / 51.6k out · claude-code 2.1.295 (claude-opus-5-5)

View session details ↗

Change Summary

  • Adds restrictive-mode validation around http.send in the Rego engine.
  • Rejects TLS request options that read local files or env vars, plus non-HTTP(S) URL schemes.
  • Wires the permissive-mode marker through engine evaluation paths.
  • Adds focused httpsend tests and mutation checks for restrictive and permissive behavior.

AI Session Overall Score

🟢 90% — Autonomous hardening run; all active judges came back green.

AI Session Analysis Breakdown

🟢 92% · scope-discipline

No notes.

🟢 91% · solution-quality

🟢 AI widened the fix to cover unix-socket URLs after reviewer feedback. · High Impact

🟢 91% · verification

🟢 Mutation checks proved both restrictive and permissive paths were really guarded. · High Impact

🟡 Autonomous run had no post-change human confirmation; rely on test evidence only. · Low Severity

🟢 89% · user-trust-signal

No notes.

🟢 88% · alignment

No notes.

🟢 86% · context-and-planning

🟢 Opening prompt front-loaded scope, workflow, secrecy, and testing constraints. · High Impact


File Attribution

████████████████████ 100% AI / 0% Human

Status Attribution File Lines
created ai pkg/policies/engine/rego/httpsend_test.go +157 / -0
created ai pkg/policies/engine/rego/httpsend.go +89 / -0
modified ai pkg/policies/engine/rego/rego.go +11 / -0

Policies (4)

Status Policy Material Messages
✅ Passed ai-config-ai-agents-allowed ai-coding-session-7f2712 -
✅ Passed ai-config-no-dangerous-commands ai-coding-session-7f2712 -
✅ Passed ai-config-no-secrets ai-coding-session-7f2712 -
✅ Passed ai-config-mcp-servers-allowed ai-coding-session-7f2712 -

Security Checks — ✅ 5 passing

✅ secret-scan

Status Policy Messages
✅ Passed secrets-detection -

✅ sast-scan

Status Policy Messages
✅ Passed owasp-top10-2025 -
✅ Passed sast -
✅ Passed cwe-top25 -
✅ Passed cwe-top26-40-cusp -
Scans not applied (3)
Scan Reason
vulnerability-scan no manifest/lockfile changed
github-actions-scan no workflow files changed
iac-scan no IaC files changed

View attestation ↗

Security context

This change touches code with 4 recorded security-fix advisories. These are pointers to what past fixes established, not findings in this diff, and they never fail the check.

View in Chainloop ↗ · How this works ↗


Powered by Chainloop and Chainloop Trace

@migmartri
migmartri marked this pull request as ready for review October 9, 2026 11:15

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

View guided diff | Re-trigger cubic

@migmartri
migmartri merged commit 5242981 into main Oct 9, 2026
17 checks passed
@migmartri
migmartri deleted the pfm-7686-reject-tls-options branch October 9, 2026 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants